using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;
using Condimar.Entities;

namespace Condimar.Repository.Mapping
{
    public class VendedorMap : EntityTypeConfiguration<Vendedor>
    {
        public VendedorMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Id)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.Nombres)
                .HasMaxLength(100);

            this.Property(t => t.Apellidos)
                .HasMaxLength(100);

            this.Property(t => t.Dni)
                .HasMaxLength(8);

            // Table & Column Mappings
            this.ToTable("Vendedor");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Nombres).HasColumnName("Nombres");
            this.Property(t => t.Apellidos).HasColumnName("Apellidos");
            this.Property(t => t.Dni).HasColumnName("Dni");
        }
    }
}
